package com.sxf.auth.enums;


import com.sxf.common.exceptions.BusinessException;

/**
 * 发送短信类型
 * @author Leo
 * */
public enum SmsTypeEnum {

	/**
	 * 发送短信类型
	 * */
	REGISTER("0","注册账号"),
	FORGET_PASSWORD("1","忘记密码"),
	SENDCODE_LOGIN("2","验证码登录"),
	;

	private final String code;
	private final String message;

	public static final String DESC = "短信类型 0 注册账号,1 忘记密码，2 验证码登录";

	SmsTypeEnum(String code, String message) {
		this.code = code;
		this.message = message;
	}

	public String getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}

	public static SmsTypeEnum getEnumByCode(String code) {
		for (SmsTypeEnum enums :SmsTypeEnum.values()) {
			if (enums.getCode().equals(code)) {
				return enums;
			}
		}
		throw new BusinessException("短信类型不存在");
	}


}
